#ifndef VERRORWIDGET_H
#define VERRORWIDGET_H

#include <QWidget>
#include <QFrame>
#include <QList>
#include <QCheckBox>
#include <qtoolbar.h>
#include "ITab.h"

namespace Ui {
class VErrorWidget;
}

class VErrorWidget : public QFrame
{
    Q_OBJECT

public:
    explicit VErrorWidget(QFrame*parent = 0);
    ~VErrorWidget();

    enum VTableItemType
    {
        INFO,
        ERROR,
        WARNING
    };

    struct VTableItem
    {
        int type;
        int line;
        int code;
        QString content;
        QString current;
        QString path;
        VTableItem(){}
        VTableItem(int type, int code, QString content,QString current, QString path, int line)
        {
            this->type = type;
            this->content = content;
            this->current = current;
            this->path = path;
            this->line = line;
            this->code = code;
        }
    };

    QCheckBox *_checkbox_error;
    QCheckBox *_checkbox_warning;
    QCheckBox *_checkbox_info;

	
    void table_add_line_data(int type, int code, QString content, QString current, QString path, int line);
    void table_add_line_data(VTableItem data);
    void table_clear();
	QWidget* get_expand_widget();

signals:
    void signal_jump(QString path, int line);

private slots:
    void on_table_error_objectNameChanged(const QString &objectName);
    void update_filter();
    void on_table_error_doubleClicked(const QModelIndex &index);

private:
    Ui::VErrorWidget *ui;
    QList<VTableItem> m_table_item_list;
	QToolBar *_toolbar;

    bool eventFilter(QObject *watched, QEvent *event);
    void table_add_line(int type, int code, QString content, QString current, QString path, int line);
    void init_count();
    void table_update();
	void init_toolbar();
};

#endif // VERRORWIDGET_H
